﻿<DemoContainer>
    <ApexChart TItem="SupportIncident"
               Title="Incident Severity"
               Options="options">

        @foreach (var source in incidents.GroupBy(e => e.Source))
        {
            <ApexPointSeries TItem="SupportIncident"
                         Items="source.OrderBy(e=>e.WeekNumber)"
                         Name="@source.Key.ToString()"
                         SeriesType="SeriesType.Heatmap"
                         XValue="@(e => e.WeekName)"
                         YAggregate="@(e => (int)e.Average(a=>a.Severity))" />
        }

    </ApexChart>
</DemoContainer>

@code {
    private List<SupportIncident> incidents { get; set; } = SampleData.GetSupportIncidents();
    private ApexChartOptions<SupportIncident> options;

    protected override void OnInitialized()
    {
        options = new ApexChartOptions<SupportIncident>
            {
                Colors = new List<string> { "#008FFB" }
            };
    }
    }